package com.louzhu.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.louzhu.common.valid.annotation.ListValue;
import com.louzhu.common.valid.groups.AddGroup;
import com.louzhu.common.valid.groups.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author jianfneg
 * @email 501039356@qq.com
 * @date 2021-07-12 15:03:31
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
	@Null(message = "新增数据时，不能指定ID字段",groups = {AddGroup.class})
	@NotNull(message = "修改数据时，必须指定ID字段",groups = {UpdateGroup.class})
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "新增、修改数据时名称必须包含一个非空字符串",groups = {AddGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "logo地址必须包含一个非空字符串",groups = {UpdateGroup.class})
	@URL(message = "logo地址不合法",groups = {AddGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	@NotBlank(message = "新增数据时，品牌介绍不能为空",groups = {UpdateGroup.class})
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "新增时，显示状态不能为空",groups = {AddGroup.class})
	@ListValue(values = {0,1},groups = {AddGroup.class,UpdateGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "新增时，首字母必须包含一个非空字符串",groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "首字母不合法",groups = {AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "新增时，排序字段不能为空",groups = {AddGroup.class})
	@Positive(message = "排序字段必须是正整数",groups = {AddGroup.class,UpdateGroup.class})
	private Integer sort;

}
